<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of DescribeDomainRecords
 *
 * @author nyf
 */
require 'AliyunClient.class.php';
require 'PingAliyun.php';
require 'BasicConfig.php';

class DescribeDomainRecords extends AliyunClient {

    public function execute($DomainName, $RRKeyWord = null, $PageNumber = null, $PageSize = null, $TypeKeyWord = null, $ValueKeyWord = null) {
        if (isset($PageNumber)) {
            $PublicParams["PageNumber"] = (int) $PageNumber;
        }
        if (isset($PageSize)) {
            $PublicParams["PageSize"] = (int) $PageSize;
        }
        if (isset($RRKeyWord)) {
            $PublicParams["RRKeyWord"] = (string) $RRKeyWord;
        }
        if (isset($TypeKeyWord)) {
            $PublicParams["TypeKeyWord"] = (string) $TypeKeyWord;
        }
        if (isset($ValueKeyWord)) {
            $PublicParams["ValueKeyWord"] = (string) $ValueKeyWord;
        }
        $PublicParams["DomainName"] = (string) $DomainName;
        $PublicParams["AccessKeyId"] = $this->accessKeyId;
        $PublicParams["Format"] = self::FORMAT;
        $PublicParams["SignatureMethod"] = self::SIGNATUREMETHOD;
        $PublicParams["SignatureVersion"] = self::SIGNATUREVERSION;
        $PublicParams["SignatureNonce"] = $this->CreateSignatureNonce();
        date_default_timezone_set("UTC");
        $PublicParams["TimeStamp"] = date(self::DATETIMEFORMAT);
        $PublicParams["Version"] = self::VERSION;
        $PublicParams["Action"] = $this->Action;
        $PublicParams["Signature"] = $this->computeSignature($PublicParams, $this->accessKeySecret);
        $requestUrl = rtrim(self::SERVERURL, "/") . "/?";
        foreach ($PublicParams as $ParamKey => $ParamValue) {
            $requestUrl .= "$ParamKey=" . urlencode($ParamValue) . "&";
        }
        $requestUrl = substr($requestUrl, 0, -1);
        return (string) $requestUrl;
    }

}
